package org.dochandler.service.domain;

import org.dochandler.service.exception.DocHandlerException;

public enum Sensitivity {
	PUBLIC { public int minimumLevel() { return Rank.SOLDIER.ordinal(); } },
	CONFIDENTIAL {	public int minimumLevel() { return Rank.CAPTAIN.ordinal(); } },
	SECRET { public int minimumLevel() { return Rank.COLONEL.ordinal(); } },
	TOP_SECRET {	public int minimumLevel() { return Rank.BRIGADIER.ordinal(); } };
	
	public abstract int minimumLevel();
	
	static public Sensitivity fromValue(String value) {
		if (value != null) {
			for (Sensitivity sensitivity : values()) {
				if (sensitivity.name().equals(value)) {
					return sensitivity;
				}
			}
		}
		throw new DocHandlerException("Impossible to create enum from value: " + value);
	}
}